<template>
  <div>
      <button @click="randomColor">点点点</button>
      <p :style="{background:pColor}">变颜色</p>
  </div>
</template>

<script>
export default {
    data(){
        return {
            pColor:''
        }
    },
    methods:{
        randomColor(){
         let a=`rgb(${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)})`
            this.pColor=a
        }
    }
}
</script>

<style>

</style>